export function useDebounceFn(fn: () => any, delay: number) {
  let timer: ReturnType<typeof setTimeout> | null = null
  return function () {
    if (timer)
      clearTimeout(timer)

    timer = setTimeout(() => {
      fn()
    }, delay)
  }
}
